{extend name="public/layout" /}
{block name="title"}
{$meetingInfo.meeting_name}
{/block}
{block name="head"}
<style>
    .weui_bar__item_on {
        background: #0085cd;
        color: #fff;
    }
</style>
<script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
    wx.config({$options | json_encode});
    wx.ready(function(){
        var data={
            title: '{$meetingInfo.meeting_name}', // 分享标题
            desc: '{$meetingInfo.meeting_description}', // 分享描述
            link: '{:get_current_url()}', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
            imgUrl: '{:strstr("http",$meetingInfo["meeting_thumb"])?$meetingInfo["meeting_thumb"]:$Request.domain.$meetingInfo["meeting_thumb"]}', // 分享图标
            success: function () {
                // 用户确认分享后执行的回调函数
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
            }
        };
        wx.onMenuShareTimeline(data);
        wx.onMenuShareAppMessage(data);
        wx.onMenuShareQQ(data);
        wx.onMenuShareWeibo(data);
        wx.onMenuShareQZone(data);

    });
</script>
{/block}
{block name="body"}
<div class="mcm-head" style="position:relative">
    <div class="head-left">
        <a href="{:url('index',['dept_id'=>$Request.param.dept_id])}" class="link">
            <span class="iconfont icon-zuoyou1"></span>
        </a>
    </div>
    <div class="head-title">
        {$meetingInfo.meeting_name}
    </div>
</div>
{notempty name='meetingInfo.meeting_focus'}
<div class="swiper-container" data-space-between='10' data-pagination='.swiper-pagination' data-autoplay="1000">
    <div class="swiper-wrapper">
        {volist name="meetingInfo.meeting_focus_text" id="vo"}
        <div class="swiper-slide">
            <img src="{$vo}" alt="" style="width:100%;">
        </div>
        {/volist}
    </div>
</div>
{/notempty}
<div class="weui-tab">
    <div class="weui-navbar">
        <a class="weui-navbar__item weui-bar__item--on" href="#tab1">
            会议介绍
        </a>
        <a class="weui-navbar__item" href="#tab2">
            参会企业
        </a>
    </div>
    <div class="weui-tab__bd">
        <div id="tab1" class="weui-tab__bd-item weui-tab__bd-item--active">
            <div class="meeting-info-box">
                <h2 class="meeting-title">{$meetingInfo.meeting_name}</h2>
                <div class="meeting-desc">
                    {$meetingInfo.meeting_description}
                </div>
                <div class="meeting-tag">
                    {php}
                    $meetingDescribe = explode(",",$meetingInfo['meeting_describe']);
                    {/php}
                    {volist name="meetingDescribe" id="vo"}
                    <span class="tag">{$vo}</span>
                    {/volist}
                </div>
                <div class="meeting-info">
                    <div class="city row">
                        <div class="row-tit">
                            <span class="iconfont icon-xiazai18"></span> 会议地点
                        </div>
                        <div class="row-con">
                            {$meetingInfo.meeting_place}
                        </div>
                    </div>
                    <div class="date row">
                        <div class="row-tit">
                            <span class="iconfont icon-riqi2"></span> 会议日期
                        </div>
                        <div class="row-con">
                            {$meetingInfo.start_time}~{$meetingInfo.end_time}
                        </div>
                    </div>
                    <div class="host row">
                        <div class="row-tit">
                            <span class="iconfont icon-zhubanfang"></span> 主办单位
                        </div>
                        <div class="row-con">
                            {php}
                            $meetingSponsor = explode("\r\n",$meetingInfo['content']['meeting_sponsor']);
                            {/php}
                            {volist name="meetingSponsor" id="vo"}
                            <b class="small-block">{$vo}</b><br/>
                            {/volist}
                        </div>
                    </div>
                    {notempty name="meetingInfo['content']['meeting_organizer']"}
                    <div class="host row">
                        <div class="row-tit">
                            <span class="iconfont icon-zhubanfang"></span> 承办单位
                        </div>
                        <div class="row-con">
                            {php}
                            $meetingOrganizer = explode("\r\n",$meetingInfo['content']['meeting_organizer']);
                            {/php}
                            {volist name="meetingOrganizer" id="vo"}
                            <b class="small-block">{$vo}</b><br/>
                            {/volist}
                        </div>
                    </div>
                    {/notempty}
                    {eq name="meetingInfo['meeting_status_text']" value="2"}
                    {notempty name="meetingInfo['meeting_status_text']"}
                    <div>
                        <a href="{$meetingInfo['meeting_receipt']}" class="weui-btn weui-btn_primary ">
                            下载回执单
                        </a>
                    </div>
                    {/notempty}
                    {/eq}
                </div>
            </div>

            <div class="meeting-roll-tab">
                <li class="item"><a href="#details">会议详情</a></li>
                {notempty name="meetingInfo['content']['meeting_process']"}
                <li class="item"><a href="#process">会议日程</a></li>
                {/notempty}
                <li class="item"><a href="#contact">联系方式</a></li>
            </div>
            <div class="meeting-info-box">
                <div class="block-tit" id="details">会议详情</div>
                <div class="meeting-content">
                    {:html_out($meetingInfo['content']['meeting_content'])}
                </div>
            </div>
            {notempty name="meetingInfo['content']['meeting_process']"}
            <div class="meeting-info-box">
                <div class="block-tit" id="process">会议日程</div>
                <div class="meeting-content">
                    <div class="mcm-timeAxis">
                        {php}
                        $meetingProcess = $meetingInfo['content']['meeting_process'];
                        $meetingProcess = explode("######",$meetingProcess);
                        foreach($meetingProcess as $k=>$v){
                        $v = explode("\r\n",$v);
                        foreach($v as $key=>$val){
                        if(!empty($val)){
                        $val = explode("|",$val);
                        $process[$k][$key] = $val;
                        }
                        }
                        }
                        {/php}
                        {volist name="process" id="vo"}
                        <ul class="items">
                            {volist name="vo" id="v" key='x'}
                            {eq name="x" value="1"}
                            <li class="item">
                                <div class="timebox ui-flex ui-flex-align-center f-tar">
                                    <span class="day">{$v[0]}</span>
                                </div>
                                <div class="item-con ui-flex ui-flex-align-center">
                                    <span class="con-tit">
                                       {$v[1]}
                                    </span>
                                </div>
                            </li>
                            {else}
                            <li class="item">
                                <div class="timebox f-tar">
                                    <span class="time">{$v[0]}</span>
                                </div>
                                <div class="item-con">
                                    <div class="con-main ui-flex ui-flex-align-center">
                                        {$v[1]}
                                    </div>
                                </div>
                            </li>
                            {/eq}
                            {/volist}
                        </ul>
                        {/volist}
                    </div>

                </div>
            </div>
            {/notempty}
            <div class="meeting-info-box">
                <div class="block-tit" id="contact">参与方式</div>
                <div class="meeting-content">
                    {:html_out($meetingInfo['content']['meeting_contact'])}
                </div>
            </div>
        </div>
        <div id="tab2" class="weui-tab__bd-item">
            <div class="companylist-box">
                <ul class="mcm-imgtext-left">
                    {volist name="meetingInfo['company_list']" id="vo"}
                    <li class="item">
                        <a class="link" onclick="bindCompany()">
                           <!--href="{:url('company/info',['dept_id'=>$Request.param.dept_id,'company_id'=>$vo.company.company_id])}">-->
                        </a>
                        <div class="thumb">
                            <img src="{$vo.company_logo}" alt="">
                        </div>
                        <div class="text-info">
                            <h2 class="info-tit">{$vo.company_name}</h2>
                            <p class="info-tag">所在区域：{$vo.area_name}</p>
                            <p class="info-desc">{$vo.company_intro}</p>
                        </div>
                    </li>
                    {/volist}
                </ul>
            </div>
        </div>
    </div>
</div>
{in name="meetingInfo['meeting_status_text']" value="0,2"}
<div style="height: 45px"></div>
<div class="company-binding">
    <a onclick="bindCompany()" class="link">
        参会人员信息登记
    </a>
</div>
{/in}
{/block}
{block name="js"}
<script src="/public/plugins/layer/layer.js"></script>
<script src="/public/plugins/template/template.js"></script>
<script type="text/html" id="bind">
    <div class="enroll-box">
        <form action="" id="bindInfo">
            <input type="hidden" name="dept_id" value="{$Request.param.dept_id}">
            <input type="hidden" name="meeting_id" value="{$Request.param.meeting_id}">
            <div class="weui-cells weui-cells_form">
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">您的姓名</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="text" name="member_truename" value="" placeholder="请输入您的姓名">
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd">
                        <label class="weui-label">手机号码</label>
                    </div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="tel" name="member_mobile" id="tel" placeholder="请输入手机号">
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd">
                        <label class="weui-label">职位</label>
                    </div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="tel" name="member_duties" placeholder="请输入职位">
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd">
                        <label class="weui-label">公司代码</label>
                    </div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" type="tel" name="company_code" placeholder="请输入公司代码">
                    </div>
                </div>
            </div>
        </form>
    </div>
</script>
<script>
    $(".swiper-container").swiper({
        loop: true,
        autoplay: 3000
    });
    $(function () {
        var obj = $('.meeting-roll-tab');
        var height = obj.offset().top;
        $(window).scroll(function () {
            var pos = $(window).scrollTop();
            if (pos > height) {
                obj.addClass('roll-tab-fixed');
            } else {
                obj.removeClass('roll-tab-fixed');
            }
        });
        $('#mobile').blur(function () {
            var mobile = $(this).val();
            var dept_id = "{$Request.param.dept_id}";
            var circle_id = "{$Request.param.circle_id}";
            $.post('{:url("bus/Index/getHistory")}', {
                mobile: mobile,
                dept_id: dept_id,
                circle_id: circle_id
            }, function (res) {
                if (!res.code) {
                    layer.msg(res.msg);
                    $('#send-sms').attr('onclick', 'alert("' + res.msg + '")');
                } else {
                    $('#send-sms').attr('onclick', 'sendSms()');
                }
            })
        });
    });

    function sendSms() {
        var mobile = $('#mobile').val();
        var code = $('#vcode').val();
        $.post('{:url("bus/Index/busSendSms")}', {
            mobile: mobile,
            vcode: code,
            dept_id: "{$Request.param.dept_id}"
        }, function (res) {
            layer.msg(res.msg, {
                end: function () {
                    if (res.code) {
                        var second = 60;
                        var inter = setInterval(function () {
                            var dom = $('#send-sms');
                            second--;
                            if (second) {
                                dom.attr('onclick', '').text('等待' + second + '秒');
                            } else {
                                dom.attr('onclick', 'sendSms()').text('发送短信');
                                clearInterval(inter);
                            }
                        }, 1000)
                    }

                }
            })
        })
    }

    function submitInfo() {
        var data = $('#info').serialize();
        $.post('{:url("sign")}', data, function (res) {
            layer.msg(res.msg);
        })
    }

    function bindCompany() {
        var html = template('bind', {});
        layer.open({
            type: 1,
            title: null,
            btn: ['绑定'],
            skin: 'layui-layer-rim', //加上边框
            area: ['70vw', '50vh'], //宽高
            content: html,
            yes: function () {
                var data = $('#bindInfo').serialize();
                $.post('{:url("bindCompany")}', data, function (res) {
                    layer.msg(res.msg, {
                        end: function () {
                            if (res.code) {
                                layer.closeAll();
                            }
                        }
                    });
                })
            }
        });
    }
</script>
{/block}
